home *** CD-ROM | disk | FTP | other *** search
- import javax.microedition.lcdui.Graphics;
- import javax.microedition.lcdui.Image;
-
- public class Sprite {
- // $FF: renamed from: x int
- private int field_0;
- // $FF: renamed from: y int
- private int field_1;
- // $FF: renamed from: dx int
- private int field_2;
- // $FF: renamed from: dy int
- private int field_3;
- private int xMax;
- private int yMax;
- private Image[] image;
- private int[][] sequenceFrame;
- private int index;
- private int state;
- private boolean gameActionLeft = false;
- private boolean gameActionRight = false;
- private boolean gameActionFire = false;
-
- public Sprite(int var1, int var2) {
- this.xMax = var1 - 14;
- this.yMax = var2;
- }
-
- public void draw(Graphics var1) {
- var1.drawImage(this.image[this.index], this.field_0, this.field_1, 20);
- }
-
- void gameActionPressed(int var1, boolean var2) {
- if (var1 == 2) {
- this.gameActionLeft = var2;
- } else if (var1 == 5) {
- this.gameActionRight = var2;
- } else if (var1 == 8) {
- this.gameActionFire = var2;
- }
-
- }
-
- public int getDx() {
- return this.field_2;
- }
-
- public int getDy() {
- return this.field_3;
- }
-
- public Image getImage(int var1) {
- return this.image[var1];
- }
-
- public int getIndex() {
- return this.index;
- }
-
- public int getState() {
- return this.state;
- }
-
- public int getX() {
- return this.field_0;
- }
-
- public int getY() {
- return this.field_1;
- }
-
- public boolean hasFired() {
- return this.gameActionFire;
- }
-
- public void setDx(int var1) {
- this.field_2 = var1;
- }
-
- public void setDy(int var1) {
- this.field_3 = var1;
- }
-
- public void setImage(Image[] var1) {
- this.image = var1;
- }
-
- public void setIndex(int var1, int var2) {
- this.index = this.sequenceFrame[var1][var2];
- }
-
- public void setSequenceFrame(int var1, int var2, int[][] var3) {
- this.sequenceFrame = new int[var1][var2];
- this.sequenceFrame = var3;
- }
-
- public void setState(int var1) {
- this.state = var1;
- }
-
- public void setX(int var1) {
- this.field_0 = var1;
- }
-
- public void setY(int var1) {
- this.field_1 = var1;
- }
-
- public void tick() {
- if (this.gameActionLeft) {
- this.index = 1;
- this.field_0 -= this.field_2;
- if (this.field_0 <= 0) {
- this.field_0 = 0;
- }
- } else if (this.gameActionRight) {
- this.index = 0;
- this.field_0 += this.field_2;
- if (this.field_0 >= this.xMax) {
- this.field_0 = this.xMax;
- }
- }
-
- }
- }
-